<div class="popup_body">
    <form method="post">
        <input type="hidden" name="portrait" id="portrait_${pid}">
        <fieldset>
            <legend>基本信息</legend>
            <div class="ui_table">
                <table cellpadding="0" cellspacing="0">
                    <tr>
                        <td width="70" align="right">姓名：</td>
                        <td><input type="text" class="text easyui-validatebox" name="realName" required maxlength="20"/>
                        </td>
                        <td width="70" align="right" valign="top" rowspan="2" style="padding-top:10px;">头像：</td>
                        <td rowspan="2">
                            <div class="portrait">
                                <a href="javascript:void(0)"><img id="image_${pid}"
                                                                  src="${app.imagePath}/user.jpg"/><span>上传头像</span></a>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td width="70" align="right">昵称：</td>
                        <td><input type="text" class="text easyui-validatebox" name="nickname" maxlength="40"/></td>
                    </tr>
                    <tr>
                        <td width="70" align="right">手机号码：</td>
                        <td><input
                                type="text" maxlength="11" class="text easyui-validatebox" required="true" name="mobile"
                                validType="mobileunique[${Session['SESSION_KEY_USER'].agentId}]"/></td>
                        <td align="right">邮件：</td>
                        <td><input type="text" class="text easyui-validatebox" name="mail" maxlength="20"/></td>
                    </tr>
                    <tr>
                        <td align="right">身份证号：</td>
                        <td><input type="text" class="text easyui-validatebox" name="idNo" required
                                   maxlength="20" validType="idnounique[${Session['SESSION_KEY_USER'].agentId}]"/></td>

                        <td align="right">绑定卡号：</td>
                        <td><input type="text" class="text easyui-validatebox" maxlength="20"
                                   name="cardNo" validType="cardnounique[${Session['SESSION_KEY_USER'].agentId}]"/></td>
                    </tr>
                    <tr>
                        <td align="right">启用：</td>
                        <td>
							<span class="radio_box">
								<input type="radio" class="radio" name="activeFlag" id="active_flag_1" checked
                                       value="1"/><label for="active_flag_1">启用</label>
							</span>
							<span class="radio_box">
								<input type="radio" class="radio" name="activeFlag" id="active_flag_0" value="0"/><label
                                    for="active_flag_0">禁用</label>
							</span>
                        </td>
                        <td align="right">性别：</td>
                        <td>
                            <span class="radio_box">
                                <input type="radio" class="radio" name="gender" id="sex_1" checked value="1"/><label
                                    for="sex_1">男</label>
                            </span>
                            <span class="radio_box">
                                <input type="radio" class="radio" name="gender" id="sex_2" value="2"/><label
                                    for="sex_2">女</label>
                            </span>
                        </td>
                    </tr>

                    <tr>
                        <td align="right">密码：</td>
                        <td><input type="password" class="text easyui-numberbox" maxlength="40" name="password"
                                   id="password_${pid}"
                                   required="true"/></td>
                        <td align="right">确认密码：</td>
                        <td><input type="password" class="text easyui-numberbox" name="password2" maxlength="40"
                                   required="true"
                                   validType="equals['#password_${pid}']"/></td>
                    </tr>
                <#if Session['SESSION_KEY_USER'].type == Session['USER_TYPE_PLATFORM'].value>
                    <td align="right">运营商：</td>
                    <td>
                        <input name="agentId" class="easyui-combotree" editable="false"
                               style="width: 184px; height: 28px;"
                               data-options="url:'${contextPath}/security/basic/agent/tree.htm?',method:'get',onSelect: function(rec){
                               var url = '${contextPath}/security/hdw/agency/tree.htm?agentId='+rec.id;
                               $('#agency_id_${pid}').combotree('reload', url);},
                               onChange:function(){
                                $('#agency_id_${pid}').combotree('clear');
                                }
                                "/>
                    </td>
                <#elseif Session['SESSION_KEY_USER'].type == Session['USER_TYPE_AGENCY'].value||Session['SESSION_KEY_USER'].type == Session['USER_TYPE_AGENT'].value>
                    <input type="hidden" name="agentId" value="${Session['SESSION_KEY_USER'].agentId}">
                </#if>
                <#if Session['SESSION_KEY_USER'].type == Session['USER_TYPE_PLATFORM'].value||Session['SESSION_KEY_USER'].type == Session['USER_TYPE_AGENT'].value>
                    <td align="right">代理商：</td>
                    <td>
                        <input name="agencyId" class="easyui-combotree" editable="false"
                               style="width: 184px; height: 28px;" id="agency_id_${pid}"
                               data-options="<#if Session['SESSION_KEY_USER'].agentId??&&Session['SESSION_KEY_USER'].agentId!=0>url:'${contextPath}/security/hdw/agency/tree.htm?agentId=${Session['SESSION_KEY_USER'].agentId}',</#if>method:'get'"/>
                    </td>
                <#elseif Session['SESSION_KEY_USER'].type == Session['USER_TYPE_AGENCY'].value>
                    <input type="hidden" name="agencyId" value="${Session['SESSION_KEY_USER'].agencyId}">
                </#if>
                </table>
            </div>
        </fieldset>
    </form>
</div>
<div class="popup_btn">
    <button class="btn btn_red ok">确定</button>
    <button class="btn btn_border close">关闭</button>
</div>
<script>
    function set_portrait(param) {
        $('#image_${pid}').attr('src', '${(controller.appConfig.staticUrl)!''}' + param.filePath);
        $('#portrait_${pid}').val(param.filePath);
        $('#' + param.pid).window('close');
    }
    (function () {
        var pid = '${pid}',
                win = $('#' + pid),
                form = win.find('form');

        win.find('button.ok').click(function () {
            form.form('submit', {
                url: '${contextPath}/security/basic/passport/create.htm',
                success: function (text) {
                    var json = $.evalJSON(text);
                <@app.json_jump/>
                    if (json.success) {
                        $.messager.alert('提示信息', '操作成功', 'info');
                        win.window('close');
                    } else {
                        $.messager.alert('提示信息', json.message, 'info');
                    }
                }
            });
        });
        win.find('button.close').click(function () {
            win.window('close');
        });
        win.find('.portrait').click(function () {
            App.dialog.show({
                css: 'width:558px;height:150px;overflow:visible;',
                title: '上传头像',
                href: "${contextPath}/security/basic/passport/portrait.htm",
                event: {
                    onClose: function () {
                    }
                }
            });
        });
    })();
</script>
